package generator.controller;

import ktkt.result.Result;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author KT917
 * @date 2022/9/15
 */

@RestController
@RequestMapping("/admin/vod/user")
//@CrossOrigin  //跨域
public class UserLoginController {

    //login
    @PostMapping("/login")
    public Result login() {
        //{code: 20000, data: {token: "admin-token"}
        Map<String, Object> stringObjectHashMap = new HashMap<>();
        stringObjectHashMap.put("token", "admin-token");
        return Result.ok(stringObjectHashMap);
    }

    //info
    @GetMapping("/info")
    public Result info() {
        //           code=20000
        //        avatar:"https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"
        //        introduction: I am a super administrator"
        //        name: "Super Admin"
        //       roles :["admin"]
        Map<String, Object> stringObjectHashMap = new HashMap<>();
        stringObjectHashMap.put("roles", "admin");
        stringObjectHashMap.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        stringObjectHashMap.put("name", "Super Admin");
        stringObjectHashMap.put("introduction", "I am a super administrator");
        return Result.ok(stringObjectHashMap);

    }

}
